package com.yzlwb.web.controller.skt;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yzlwb.common.annotation.Log;
import com.yzlwb.common.core.controller.BaseController;
import com.yzlwb.common.core.domain.AjaxResult;
import com.yzlwb.common.enums.BusinessType;
import com.yzlwb.skt.domain.SktTaskConstruct;
import com.yzlwb.skt.service.ISktTaskConstructService;
import com.yzlwb.common.utils.poi.ExcelUtil;
import com.yzlwb.common.core.page.TableDataInfo;

/**
 * 任务创建记录Controller
 * 
 * @author wfy
 * @date 2025-11-14
 */
@RestController
@RequestMapping("/yzlwb/construct")
public class SktTaskConstructController extends BaseController
{
    @Autowired
    private ISktTaskConstructService sktTaskConstructService;

    /**
     * 查询任务创建记录列表
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:list')")
    @GetMapping("/list")
    public TableDataInfo list(SktTaskConstruct sktTaskConstruct)
    {
        startPage();
        List<SktTaskConstruct> list = sktTaskConstructService.selectSktTaskConstructList(sktTaskConstruct);
        return getDataTable(list);
    }

    /**
     * 导出任务创建记录列表
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:export')")
    @Log(title = "任务创建记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SktTaskConstruct sktTaskConstruct)
    {
        List<SktTaskConstruct> list = sktTaskConstructService.selectSktTaskConstructList(sktTaskConstruct);
        ExcelUtil<SktTaskConstruct> util = new ExcelUtil<SktTaskConstruct>(SktTaskConstruct.class);
        util.exportExcel(response, list, "任务创建记录数据");
    }

    /**
     * 获取任务创建记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sktTaskConstructService.selectSktTaskConstructById(id));
    }

    /**
     * 新增任务创建记录
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:add')")
    @Log(title = "任务创建记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SktTaskConstruct sktTaskConstruct)
    {
        return toAjax(sktTaskConstructService.insertSktTaskConstruct(sktTaskConstruct));
    }

    /**
     * 修改任务创建记录
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:edit')")
    @Log(title = "任务创建记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SktTaskConstruct sktTaskConstruct)
    {
        return toAjax(sktTaskConstructService.updateSktTaskConstruct(sktTaskConstruct));
    }

    /**
     * 删除任务创建记录
     */
    @PreAuthorize("@ss.hasPermi('yzlwb:construct:remove')")
    @Log(title = "任务创建记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sktTaskConstructService.deleteSktTaskConstructByIds(ids));
    }
}
